package com.gary.demo.common.model;

import lombok.Data;

@Data
public class Result <T>{

    private Boolean success;

    private String errorMsg;

    private T data;

    public static Result fail(String errorMsg) {
        Result result = new Result();
        result.setSuccess(false);
        result.setErrorMsg(errorMsg);
        return result;
    }

    public static <T>Result success(T data) {
        Result<T> result = new Result<>();
        result.setSuccess(true);
        result.setData(data);
        return result;
    }

}
